package LoginPackage;

import org.testng.annotations.Test;
import PagePackage.MyPageFactory;
import PagePackage.teamsPage;


public class TeamsSearch extends TestBaseClass {
	
	
	@Test (priority=0)
	public void AdminSearchTeamByName() {
	goToMainPage();
	checkPage()
	.loginAs(adminEmail, adminPassword)
	.clickteamtab();
	 MyPageFactory.getPage(driver, teamsPage.class).findTeambyName("Football Team")
	.clickSearch()
	.scrollAndClickTeam(0, 0, "//*[contains(text(),'Football Team')]")
	.logout();	
		
	}
	
	@Test (priority=1)
	public void AdminSearchTeamByBasketballSport() {
	goToMainPage();
	checkPage()
	.loginAs(adminEmail, adminPassword)
	.clickteamtab()
	.findTeambySport("Basketball")
	.clickSearch()
	.clickonFirstResult()
    .checkSport("Basketball")
	.cancelTeam()
	.logout();

}
	
	
	@Test (priority=2)
	public void AdminSearchTeamByFootballSport() {
		goToMainPage();
	checkPage()
	.loginAs(adminEmail, adminPassword)
	.clickteamtab()
	.findTeambySport("Football")
	.clickSearch()
	.clickonFirstResult()
	.checkSport("Football")
	.cancelTeam()
	.logout();
}
	@Test (priority=3)
	public void AdminSearchTeamByLacrosseSport() {
		goToMainPage();
	checkPage()
	.loginAs(adminEmail, adminPassword)
	.clickteamtab()
	.findTeambySport("Lacrosse")
	.clickSearch()
	.clickonFirstResult()
	.checkSport("Lacrosse")
	.cancelTeam()
	.logout();
}
	
	
	@Test (priority=4)
	public void AdminSearchTeamByLeagueName() {
		goToMainPage();
	 checkPage()
	.loginAs(adminEmail, adminPassword)
	.clickteamtab()
	.findTeambyLeague("Football League")
	.clickSearch()
	.clickonFirstResult()
	.checkLeague("Football League")
	.cancelTeam()
	.logout();
}

	@Test (priority=5)
	public void AdminSearchTeamBySchool() {
		goToMainPage();
	checkPage()
	.loginAs(adminEmail, adminPassword)
	.clickteamtab()
	.findTeambySchool("Basketball University")
	.clickSearch()
	.clickonFirstResult()
	.checkSchool("Basketball University")
	.cancelTeam()		
	.logout();
	
	
	}
	
	
	
	
	@Test (priority=6)
	public void AdminSearchTeamByTeamNameSportLeagueSchool() {
		goToMainPage();
	 checkPage()
	.loginAs(adminEmail, adminPassword)
	.clickteamtab()
	.findTeambyName("Football Team")
	.findTeambySport("Football")
	.findTeambyLeague("NCAA FBS")
	.findTeambySchool("Oregon State University")
	.clickSearch()
	.clickonFirstResult()
	.checkSport("Football")
	.checkLeague("NCAA FBS")
	.checkSchool("Oregon State University")
	.logout();
}
	
	@Test (priority=7)
	public void AdminSearchTeamNoResults() {
	goToMainPage();
	checkPage()
	.loginAs(adminEmail, adminPassword)
	.clickteamtab()
	.findTeambyName("Football Team 123")
	.clickSearch()
	.noResults()
			
	.logout();
	}
	
	@Test (priority=8)
	public void SASearchTeamByName() {
	goToMainPage();
	checkPage()
	.loginAs(saEmail, saPassword)
	.clickteamtab();
	 MyPageFactory.getPage(driver, teamsPage.class).findTeambyName("Football Team")
	.clickSearch()
	.scrollAndClickTeam(0, 0, "//*[contains(text(),'Football Team')]")
	.logout();	
		
	}
	
	@Test (priority=9)
	public void SASearchTeamByBasketballSport() {
	goToMainPage();
	checkPage()
	.loginAs(saEmail, saPassword)
	.clickteamtab()
	.findTeambySport("Basketball")
	.clickSearch()
	.clickonFirstResult()
	.checkSport("Basketball")
	.cancelTeam()
	.logout();

}
	
	
	@Test (priority=10)
	public void SASearchTeamByFootballSport() {
		goToMainPage();
	checkPage()
	.loginAs(saEmail, saPassword)
	.clickteamtab()
	.findTeambySport("Football")
	.clickSearch()
	.clickonFirstResult()
	.checkSport("Football")
	.cancelTeam()
	.logout();
}
	@Test (priority=11)
	public void SASearchTeamByLacrosseSport() {
		goToMainPage();
	checkPage()
	.loginAs(saEmail, saPassword)
	.clickteamtab()
	.findTeambySport("Lacrosse")
	.clickSearch()
	.clickonFirstResult()
	.checkSport("Lacrosse")
	.cancelTeam()
	.logout();
}
	
	
	@Test (priority=12)
	public void SASearchTeamByLeagueName() {
		goToMainPage();
	 checkPage()
	.loginAs(saEmail, saPassword)
	.clickteamtab()
	.findTeambyLeague("Football League")
	.clickSearch()
	.clickonFirstResult()
	.checkLeague("Football League")
	.cancelTeam()
	.logout();
}

	@Test (priority=13)
	public void SASearchTeamBySchool() {
		goToMainPage();
	checkPage()
	.loginAs(saEmail, saPassword)
	.clickteamtab()
	.findTeambySchool("Basketball University")
	.clickSearch()
	.clickonFirstResult()
	.checkSchool("Basketball University")
	.cancelTeam()		
	.logout();
	
	
	}
	
	
	
	
	@Test (priority=14)
	public void SASearchUserByTeamNameSportLeagueSchool() {
		goToMainPage();
	checkPage()
	.loginAs(saEmail, saPassword)
	.clickteamtab()
	.findTeambyName("Football Team")
	.findTeambySport("Football")
	.findTeambyLeague("NCAA FBS")
	.findTeambySchool("Oregon State University")
	.clickSearch()
	.clickonFirstResult()
	.checkSport("Football")
	.checkLeague("NCAA FBS")
	.checkSchool("Oregon State University")
	.logout();
}	

@Test (priority=15)
	public void SASearchTeamNoResults() {
	goToMainPage();
	checkPage()
	.loginAs(saEmail, saPassword)
	.clickteamtab()
	.findTeambyName("Football Team 123")
	.clickSearch()
	.noResults()
	.logout();
	}
	
}